<template>
  <div class="demo">
    <h2>学校名称:{{ schoolName }}</h2>
    <h2>学校地址:{{ address }}</h2>
    <button @click="showSchoolName">点我提示学校名</button>
  </div>
</template>

<script>
//vue.extend()也可以省略
export default Vue.extend({
  name: "School",
  data: function () {
    return {
      schoolName: "尚硅谷",
      address: "北京",
    };
  },
  methods: {
    showSchoolName: function () {
      console.log("hello");
    },
  },
});
</script>

<style>
.demo {
  background-color: forestgreen;
}
</style>